home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Burning & Media / MediaMonkey 3.06 / MediaMonkey_3.0.6.1190.exe / {app} / Scripts / Export.vbs < prev    next >
Text File  |  2008-08-28  |  17KB  |  592 lines

  1. ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2. ' This file can be replaced  in one of the future versions,
  3. ' so please if you want to modify it, make  a copy, do your
  4. ' modifications  in that copy and  change Scripts.ini  file 
  5. ' appropriately. 
  6. ' If you do not do this, you will lose  all your changes in
  7. ' this script when you install a new version of MediaMonkey
  8. ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9.  
  10. Option Explicit     ' report undefined variables, ...
  11.  
  12. ' function for quoting strings
  13. Function QStr( astr)
  14.   QStr = chr(34) & astr & chr(34)
  15. End Function
  16.  
  17. ' function for quoting strings converted to plain ASCII
  18. Function QAStr( astr)
  19.   QAStr = chr(34) & SDB.toASCII(astr) & chr(34)
  20. End Function
  21.  
  22. Dim list      ' list of songs to be exported
  23. Dim res       ' results of dialogs calls
  24. Dim fullfile  ' fully specified output file name
  25. Dim fso       ' FileSystemObject
  26.  
  27. ' SDB variable is connected to MediaMonkey application object
  28.  
  29. Sub InitExport( ext, filter, iniDirValue)
  30.   fullfile = ""
  31.  
  32.   ' Get a list of songs to be exported
  33.   Set list = SDB.CurrentSongList
  34.  
  35.   If list.count=0 Then
  36.     res = SDB.MessageBox( SDB.Localize("Select tracks to be exported, please."), mtError, Array(mbOk))
  37.     Exit Sub
  38.   End If
  39.  
  40.   ' Open inifile and get last used directory
  41.   Dim iniF
  42.   Set iniF = SDB.IniFile
  43.  
  44.   ' Create common dialog and ask where to save the file
  45.   Dim dlg
  46.   Set dlg = SDB.CommonDialog
  47.   dlg.DefaultExt=ext
  48.   dlg.Filter=filter
  49.   dlg.Flags=cdlOFNOverwritePrompt + cdlOFNHideReadOnly + cdlOFNNoChangeDir
  50.   dlg.InitDir = iniF.StringValue( "Scripts", iniDirValue)
  51.   dlg.ShowSave
  52.  
  53.   if Not dlg.Ok Then
  54.     Exit Sub   ' if cancel was pressed, exit
  55.   End If
  56.  
  57.   ' Get the selected filename
  58.   fullfile = dlg.FileName
  59.  
  60.   ' Connect to the FileSystemObject
  61.   Set fso = SDB.Tools.FileSystem
  62.  
  63.   ' Write selected directory to the ini file
  64.   iniF.StringValue( "Scripts", iniDirValue) = fullfile
  65. End Sub
  66.  
  67. Function FormatStrTime (StrTimeValue)
  68.   FormatStrTime = ""
  69.  
  70.   If Len (StrTimeValue) > 0 Then
  71.     Dim BeginPosition, Position, TimePart, TimePartsCount
  72.     BeginPosition = 1
  73.     Position = InStr (BeginPosition, StrTimeValue, ":", vbTextCompare)
  74.     TimePartsCount = 0
  75.  
  76.     Do While Position > 0
  77.       TimePartsCount = TimePartsCount + 1
  78.       BeginPosition = Position + 1
  79.       Position = InStr (BeginPosition, StrTimeValue, ":", vbTextCompare)
  80.     Loop
  81.  
  82.     For TimePart = 1 to 2 - TimePartsCount
  83.       FormatStrTime = FormatStrTime + "00:"
  84.     Next
  85.   Else
  86.     StrTimeValue = "00:00:00"
  87.   End If
  88.  
  89.   FormatStrTime = FormatStrTime + StrTimeValue
  90.   FormatStrTime = Replace (FormatStrTime, " ", "", 1, -1, vbTextCompare)
  91. End Function
  92.  
  93. Sub FinishExport( ok)
  94.   On Error Resume Next
  95.  
  96.   ' remove the output file if terminated
  97.   if not Ok then
  98.     fso.DeleteFile( fullfile)
  99.   end if
  100. End Sub
  101.  
  102. Sub ExportCSV
  103.   ' initialize export
  104.   Call InitExport (".csv", "CSV (*.csv)|*.csv|All files (*.*)|*.*", _
  105.       "LastExportCSVDir")
  106.   if fullfile="" then
  107.     Exit Sub
  108.   end if
  109.  
  110.   ' Create the output file
  111.   Dim fout
  112.   Set fout = fso.CreateTextFile( fullfile, True)
  113.  
  114.   ' Write header line
  115.   fout.WriteLine Join(Array(SDB.Localize("Artist"),SDB.Localize("Title"), _
  116.     SDB.Localize("Album"),SDB.Localize("Length"),SDB.Localize("Year"), _
  117.     SDB.Localize("Genre"),SDB.Localize("Rating"),SDB.Localize("Bitrate"), _
  118.     SDB.Localize("Path"),SDB.Localize("Media")),",")
  119.  
  120.   ' Use progress to notify user about the current action
  121.   Dim Progress
  122.   Set Progress = SDB.Progress
  123.   Progress.Text = SDB.Localize("Exporting...")
  124.  
  125.   ' Iterate through the list and export all songs
  126.   Progress.MaxValue = list.count
  127.   Dim i, itm
  128.   for i=0 to list.count-1
  129.     Set itm = list.Item(i)
  130.     Dim bitrate
  131.     bitrate = itm.bitrate
  132.     if bitrate>0 then
  133.       bitrate = CStr(Round( bitrate/1000))
  134.     else
  135.       bitrate = ""
  136.     end if
  137.     fout.WriteLine Join( Array( QAStr(itm.ArtistName), QAStr(itm.title), QAStr(itm.AlbumName), _
  138.       QAStr(itm.SongLengthString), CStr(itm.Year), QAStr(itm.Genre), CStr(itm.Rating), CStr(bitrate), _
  139.       QAStr(itm.Path), QAStr(itm.MediaLabel)), ",")
  140.     Progress.Value = i+1
  141.     if Progress.Terminate then
  142.       Exit For
  143.     end if
  144.   next
  145.  
  146.   ' Close the output file and finish
  147.   fout.Close
  148.  
  149.   ' Was it successfull?
  150.   Dim ok
  151.   if Progress.Terminate then
  152.     ok = False
  153.   else
  154.     ok = True
  155.   end if
  156.  
  157.   ' hide progress
  158.   Set Progress = Nothing
  159.  
  160.   Call FinishExport( ok)
  161. End Sub
  162.  
  163.  ' escape XML string
  164. Function MapXML( srcstring)
  165.   srcstring = Replace( srcstring, "&", "&")
  166.   srcstring = Replace( srcstring, "<", "<")
  167.   srcstring = Replace( srcstring, ">", ">")
  168.   Dim i
  169.   i=1
  170.   While i<=Len(srcstring)
  171.     If (AscW(Mid(srcstring, i, 1))>127) Then
  172.       srcstring = Mid( srcstring, 1, i-1)+"&#"+CStr( AscW( Mid( srcstring, i, 1)))+";"+Mid( srcstring, i+1, Len(srcstring))
  173.     End If
  174.     i=i+1
  175.   WEnd
  176.   MapXML = srcstring
  177. End Function
  178.  
  179.  
  180. Sub ExportHTML 
  181.   ' initialize export 
  182.   Call InitExport( ".htm", "HTML (*.htm)|*.htm|All files (*.*)|*.*", _ 
  183.   "LastExportHTMLDir") 
  184.   if fullfile="" then 
  185.   Exit Sub 
  186.   end if 
  187.  
  188.   ' Create the output file 
  189.   Dim fout 
  190.   Set fout = fso.CreateTextFile( fullfile, True) 
  191.  
  192.   ' Write header line 
  193.   fout.WriteLine "<html>" 
  194.   fout.WriteLine "<head><title>" & SDB.Localize("MediaMonkey Track List") & "</title>" 
  195.  
  196.   ' Code to format the document 
  197.   fout.WriteLine "<style type=text/css>" 
  198.   fout.WriteLine "body{font-family:'Verdana',sans-serif; background-color:#FFFFFF; font-size:9pt; color:#000000;}" 
  199.   fout.WriteLine "H1{font-family:'Verdana',sans-serif; font-size:13pt; font-weight:bold; color:#AAAAAA; text-aligh:left}" 
  200.   fout.WriteLine "P{font-family:'Verdana',sans-serif; font-size:9pt; color:#000000;}" 
  201.   fout.WriteLine "TH{font-family:'Verdana',sans-serif; font-size:10pt; font-weight:bold; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:3px;}" 
  202.   fout.WriteLine "TD{font-family:'Verdana',sans-serif; font-size:9pt; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:1px;}" 
  203.   fout.Writeline "TD.dark{background-color:#EEEEEE}" 
  204.   fout.WriteLine "</style>" 
  205.  
  206.   fout.WriteLine "</head><body>" 
  207.   fout.WriteLine "<a href='http://www.mediamonkey.com'><h1>" & SDB.Localize("MediaMonkey Track List")&"</h1></a>" 
  208.  
  209.   ' Headers of table 
  210.   fout.WriteLine "<table cellpadding=4 cellspacing=0>" 
  211.   fout.WriteLine "<tr align=left>" 
  212.   fout.WriteLine " <th id=dark>#</th>" 
  213.   fout.WriteLine " <th>" & SDB.Localize("Artist") & "</th>" 
  214.   fout.WriteLine " <th id=dark>" & SDB.Localize("Title") & "</th>" 
  215.   fout.WriteLine " <th>" & SDB.Localize("Length") & "</th>" 
  216.   fout.WriteLine " <th id=dark>" & SDB.Localize("Album") & "</th>" 
  217.   fout.WriteLine " <th>" & SDB.Localize("Track #") & "</th>" 
  218.   fout.WriteLine " <th id=dark>" & SDB.Localize("Year") & "</th>" 
  219.   fout.WriteLine " <th>" & SDB.Localize("Genre") & "</th>" 
  220.   fout.WriteLine " <th id=dark>" & SDB.Localize("Rating") & "</th>" 
  221.   fout.WriteLine " <th>" & SDB.Localize("Bitrate") & "</th>" 
  222.   fout.WriteLine " <th id=dark>" & SDB.Localize("Media") & "</th>" 
  223.   fout.WriteLine "</tr>" 
  224.  
  225.   ' Use progress to notify user about the current action 
  226.   Dim Progress 
  227.   Set Progress = SDB.Progress 
  228.   Progress.Text = SDB.Localize("Exporting...")
  229.  
  230.   ' Iterate through the list and export all songs 
  231.   Progress.MaxValue = list.count 
  232.   Dim i, itm, Duration
  233.   for i=0 to list.count-1 
  234.     Set itm = list.Item(i) 
  235.     Dim bitrate 
  236.     bitrate = itm.bitrate 
  237.     if bitrate>0 then 
  238.       bitrate = CStr(Round( bitrate/1000)) 
  239.     else 
  240.       bitrate = " " 
  241.     end if 
  242.     Dim year 
  243.     year = itm.year 
  244.     if year<=0 then 
  245.       year = " " 
  246.     else 
  247.       year = CStr( year) 
  248.     end if 
  249.  
  250.     ' Add space to empty fields, so table is displayed correctly (Cell borders do not show up for empty cells) 
  251.     Dim artistname 
  252.     artistname = MapXML(itm.ArtistName)
  253.     if artistname="" then 
  254.       artistname = " " 
  255.     end if 
  256.  
  257.     Dim songtitle 
  258.     songtitle = MapXML(itm.title)
  259.     if songtitle="" then 
  260.       songtitle = " " 
  261.     end if 
  262.  
  263.     Dim albumname 
  264.     albumname = MapXML(itm.AlbumName)
  265.     if albumname="" then 
  266.       albumname = " " 
  267.     end if 
  268.  
  269.     Dim songlength
  270.     songlength = itm.SongLengthString
  271.  
  272.     if songlength="" then 
  273.       songlength = " " 
  274.     else
  275.       Duration = Duration + TimeValue (FormatStrTime (songlength))
  276.     end if
  277.  
  278.     Dim songgenre 
  279.     songgenre = MapXML(itm.Genre)
  280.     if songgenre="" then 
  281.       songgenre = " " 
  282.     end if 
  283.  
  284.     Dim trackorder 
  285.     trackorder = itm.TrackOrder 
  286.     if trackorder="" then 
  287.       trackorder = " " 
  288.     elseif trackorder = "0" then 
  289.       trackorder = " " 
  290.     end if 
  291.  
  292.     ' These are added to get some decent display, all the others haven't, this script is just to demonstrate all the available options 
  293.  
  294.     Dim rating 
  295.     Dim ratingCal
  296.     rating = itm.Rating 
  297.     
  298.     Select Case rating
  299.   Case ""
  300.     ratingCal = " "
  301.   Case -1
  302.     ratingCal = " "
  303.   Case 100
  304.     ratingCal = 5
  305.   Case 90
  306.     ratingCal = 4.5
  307.   Case 80
  308.     ratingCal = 4
  309.   Case 70
  310.     ratingCal = 3.5
  311.   Case 60
  312.     ratingCal = 3
  313.   Case 50
  314.     ratingCal = 2.5
  315.   Case 40
  316.     ratingCal = 2
  317.   Case 30
  318.     ratingCal = 1.5
  319.   Case 20
  320.     ratingCal = 1
  321.   Case 10
  322.     ratingCal = 0.5
  323.   Case 0
  324.     ratingCal = 0
  325.   Case Else
  326.     ratingCal = " "
  327.     End Select
  328.   
  329.     Dim medialabel
  330.     medialabel = MapXML(itm.MediaLabel)
  331.     if medialabel="" then 
  332.       medialabel = " " 
  333.     end if
  334.  
  335.     ' Body of the table 
  336.     fout.WriteLine "<tr><td align=right class=dark>"&i+1&"</td><td>"&artistname&"</td><td class=dark>"&songtitle _ 
  337.     &"</td><td align=right>"&songlength&"</td><td class=dark>"&albumname _ 
  338.     &"</td><td align=right>"&trackorder&"</td><td align=right class=dark>"&Year _ 
  339.     &"</td><td>"&songgenre&"</td><td class=Dark>"&ratingCal&"</td><td align=right>"&bitrate _ 
  340.     &"</td><td align=right class=Dark>"&medialabel&"</td></tr>" 
  341.     Progress.Value = i+1 
  342.     if Progress.Terminate then 
  343.       Exit For 
  344.     end if 
  345.   next 
  346.  
  347.   ' Write some code to finish html document 
  348.   fout.WriteLine "</table><p/><table width=100%><tr>"
  349.   fout.WriteLine "<td style='border-bottom-width:0px'><b>"&SDB.Localize("Total Tracks:")&" </b>"&i&"</td>"
  350.   fout.WriteLine "</tr><tr>"
  351.   fout.WriteLine "<td style='border-bottom-width:0px'><b>"&SDB.Localize("Duration:")&" </b>"&Hour (Duration)& "h " &Minute (Duration)& "m " &Second (Duration)& "s</td>"
  352.   fout.WriteLine "<td align=right style='border-bottom-width:0px'>Generated by <a href='http://www.mediamonkey.com'>MediaMonkey</a></td>"
  353.   fout.WriteLine "</tr></table></body></html>"
  354.  
  355.   ' Close the output file and finish 
  356.   fout.Close 
  357.  
  358.   ' Was it successfull? 
  359.   Dim ok 
  360.   if Progress.Terminate then 
  361.     ok = False 
  362.   else 
  363.     ok = True 
  364.   end if 
  365.  
  366.   ' hide progress 
  367.   Set Progress = Nothing 
  368.  
  369.   FinishExport( ok) 
  370. End Sub 
  371.  
  372.  
  373. Sub ExportXLS
  374.   ' initialize export
  375.   Call InitExport( ".xls", "Excel sheet (*.xls)|*.xls|All files (*.*)|*.*", _
  376.         "LastExportExcelDir")
  377.   if fullfile="" then
  378.     Exit Sub
  379.   end if
  380.  
  381.   if fso.FileExists( fullfile) then
  382.     fso.DeleteFile( fullfile)
  383.   end if
  384.  
  385.   On Error Resume Next
  386.  
  387.   ' Connect to Excel
  388.   Dim Excel, WB, WS
  389.   Set Excel = CreateObject("Excel.application")
  390.  
  391.   If Err.Number<>0 then
  392.     MsgBox "Microsoft Excel could not be found, please install it and try again."
  393.     Err.Clear
  394.     Exit Sub
  395.   End If
  396.   On Error GoTo 0
  397.  
  398.   ' Create a new workbook and get its worksheet
  399.   Set WB = Excel.WorkBooks.Add
  400.   Set WS = WB.Sheets(1)
  401.  
  402.   ' Use progress to notify user about the current action
  403.   Dim Progress
  404.   Set Progress = SDB.Progress
  405.   Progress.Text = SDB.Localize("Exporting...")
  406.  
  407.   ' Create a header
  408.   WS.Cells(1,1).Value = SDB.Localize("Artist")
  409.   WS.Cells(1,2).Value = SDB.Localize("Album")
  410.   WS.Cells(1,3).Value = SDB.Localize("Title")
  411.   WS.Cells(1,4).Value = SDB.Localize("Length")
  412.   WS.Cells(1,5).Value = SDB.Localize("Year")
  413.   WS.Cells(1,6).Value = SDB.Localize("Genre")
  414.   WS.Cells(1,7).Value = SDB.Localize("Bitrate")
  415.   WS.Cells(1,8).Value = SDB.Localize("Media")
  416.  
  417.   WS.Rows("1:1").Font.Bold = True
  418.  
  419.   Dim ms2Day
  420.   ms2Day = 24*60*60*1000
  421.  
  422.   ' Iterate through the list and export all songs
  423.   Progress.MaxValue = list.count
  424.   Dim i, itm
  425.   for i=0 to list.count-1
  426.     Set itm = list.Item(i)
  427.     Dim bitrate
  428.     bitrate = itm.bitrate
  429.     if bitrate>0 then
  430.       bitrate = CStr(Round( bitrate/1000))
  431.     else
  432.       bitrate = ""
  433.     end if
  434.     Dim year
  435.     year = itm.year
  436.     if year<=0 then
  437.       year = ""
  438.     else
  439.       year = CStr( year)
  440.     end if
  441.  
  442.     WS.Cells(i+2,1).Value = itm.ArtistName
  443.     WS.Cells(i+2,2).Value = itm.AlbumName
  444.     WS.Cells(i+2,3).Value = itm.title
  445.     WS.Cells(i+2,4).NumberFormat = "mm:ss"
  446.     If itm.SongLength>=0 Then
  447.       WS.Cells(i+2,4).Value = itm.SongLength / ms2Day
  448.     End If
  449.     WS.Cells(i+2,5).Value = year
  450.     WS.Cells(i+2,6).Value = itm.Genre
  451.     WS.Cells(i+2,7).Value = bitrate
  452.     WS.Cells(i+2,8).Value = itm.MediaLabel
  453.  
  454.     Progress.Value = i+1
  455.     if Progress.Terminate then
  456.       Exit For
  457.     end if
  458.   next
  459.  
  460.   ' Was it successfull?
  461.   Dim ok
  462.   if Progress.Terminate then
  463.     ok = False
  464.   else
  465.     ok = True
  466.     WB.SaveAs fullfile
  467.   end if
  468.  
  469.   WB.Close false
  470.  
  471.   ' hide progress
  472.   Set Progress = Nothing
  473.  
  474.   FinishExport( ok)
  475. End Sub
  476.  
  477. Sub ExportXML
  478.   ' initialize export
  479.   Call InitExport (".xml", "XML (*.xml)|*.xml|All files (*.*)|*.*", _
  480.       "LastExportXMLDir")
  481.   if fullfile="" then
  482.     Exit Sub
  483.   end if
  484.  
  485.   ' Create the output file
  486.   Dim fout
  487.   Set fout = fso.CreateTextFile( fullfile, True)
  488.  
  489.   ' Use progress to notify user about the current action
  490.   Dim Progress
  491.   Set Progress = SDB.Progress
  492.   Dim ProgressString
  493.   ProgressString = SDB.Localize("Exporting...")
  494.  
  495.   Dim i
  496.   Dim Artists, Artist
  497.   Set Artists = list.Artists
  498.   Dim Albums, Album
  499.   Set Albums = list.Albums
  500.  
  501.   fout.WriteLine "<?xml version='1.0'?>"
  502.   fout.WriteLine "<MusicDatabase>"
  503.  
  504.   Progress.MaxValue = list.count + Artists.Count + Albums.Count
  505.  
  506.   Progress.Text = ProgressString & " (artists)"
  507.   fout.WriteLine "  <Artists>"
  508.   for i=0 to Artists.count-1
  509.     Set Artist = Artists.Item(i)
  510.     fout.WriteLine "    <Artist id=""Artist_"&Artist.id&""">"
  511.     fout.WriteLine "       <Name>" & MapXML(Artist.Name) & "</Name>"
  512.     fout.WriteLine "    </Artist>"
  513.     Progress.Increase
  514.     if Progress.Terminate then
  515.       Exit For
  516.     end if
  517.   next
  518.   fout.WriteLine "  </Artists>"
  519.  
  520.   Progress.Text = ProgressString & " (albums)"
  521.   fout.WriteLine "  <Albums>"
  522.   for i=0 to Albums.count-1
  523.     Set Album = Albums.Item(i)
  524.     fout.WriteLine "    <Album id=""Album_"&Album.id&""">"
  525.     fout.WriteLine "       <PerformingArtist id="""& Album.Artist.id & """>" & MapXML(Album.Artist.Name) & "</PerformingArtist>"
  526.     fout.WriteLine "       <Name>" & MapXML(Album.Name) & "</Name>"
  527.     fout.WriteLine "    </Album>"
  528.     Progress.Increase
  529.     if Progress.Terminate then
  530.       Exit For
  531.     end if
  532.   next
  533.   fout.WriteLine "  </Albums>"
  534.  
  535.   ' Iterate through the list and export all songs
  536.   Progress.Text = ProgressString & " (songs)"
  537.   fout.WriteLine "  <Songs>"
  538.   Progress.MaxValue = list.count
  539.   Dim Song, Media
  540.   for i=0 to list.count-1
  541.     Set Song = list.Item(i)
  542.     fout.WriteLine "    <Song id=""Song_"&Song.id&""">"
  543.     fout.WriteLine "       <Title>" & MapXML(Song.Title) & "</Title>"
  544.     fout.WriteLine "       <PerformingArtist id=""Artist_"& Song.Artist.id & """>" & MapXML(Song.ArtistName) & "</PerformingArtist>"
  545.     fout.WriteLine "       <ContainedInAlbum id=""Album_"& Song.Album.id & """>" & MapXML(Song.AlbumName) & "</ContainedInAlbum>"
  546.     fout.WriteLine "       <SongLength ms="""& Song.SongLength &""">" & MapXML(Song.SongLengthString) & "</SongLength>"
  547.     if Song.Year>0 then
  548.       fout.WriteLine "       <Year value="""& MapXML(Song.Year) &"""/>"
  549.     end if
  550.     if Song.Genre<>"" then
  551.       fout.WriteLine "       <Genre>"& MapXML(Song.Genre) &"</Genre>"
  552.     end if
  553.     fout.WriteLine "       <Bitrate>"& MapXML(Song.Bitrate) &"</Bitrate>"
  554.  
  555.     fout.WriteLine "       <Location>"
  556.     Set Media = Song.Media
  557.     If Not IsNull( Media) And Not IsEmpty( Media) And IsObject( Media) Then
  558.       fout.WriteLine "         <Media id=""Media_"&Media.id&""" sn=""" & _
  559.         Media.SerialNumber & """>"& MapXML(Media.MediaLabel) &"</Media>"
  560.     End If
  561.  
  562.     fout.WriteLine "         <Path>"& MapXML(Song.Path) &"</Path>"
  563.     fout.WriteLine "       </Location>"
  564.  
  565.     fout.WriteLine "    </Song>"
  566.     Progress.Increase
  567.     if Progress.Terminate then
  568.       Exit For
  569.     end if
  570.   next
  571.   fout.WriteLine "  </Songs>"
  572.  
  573.   fout.WriteLine "</MusicDatabase>"
  574.  
  575.   ' Close the output file and finish
  576.   fout.Close
  577.  
  578.   ' Was it successfull?
  579.   Dim ok
  580.   if Progress.Terminate then
  581.     ok = False
  582.   else
  583.     ok = True
  584.   end if
  585.  
  586.   ' hide progress
  587.   Set Progress = Nothing
  588.  
  589.   Call FinishExport( ok)
  590. End Sub
  591.  
  592.